import 'package:flutter/material.dart';

class DialogUtil {
  static void showDialogEz(
      BuildContext context, String title, String content, String cancel, String confirm, VoidCallback onPressed) {
    showDialog(
        context: context,
        barrierColor: Colors.black54, //设置透明底色,自定义也可能会用到
        builder: (BuildContext context) {
          return AlertDialog(
              title: Text(title),
              content: Text(content),
              actions: [
                TextButton(
                    onPressed: () {
                      Navigator.of(context).pop();
                      onPressed();
                    },
                    child: Text(confirm)),
                TextButton(
                    onPressed: () {
                      Navigator.of(context).pop();
                    },
                    child: Text(cancel))
              ],
              shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)));
        });
  }
}
